***File used to compute RI statistics for Murphy et al. "Chatting at Church: Information Diffusion through Religious Networks"





clear all
macro drop _all

*CUSTOM DO FILES
ssc install matmap

global user "[INSERT PATH HERE]"
cd "${user}"

***Table A3***

use churchindvstatistics, clear

egen villchurchcount=count(churchid), by(villagenum)

gen churchmedian=churchmeandist
gen yearestmedian=yearest

collapse (mean) (churchmeandist yearest villchurchcount) (median) (churchmedian yearestmedian), by(villagenum)

order villagenum villchurchcount churchmeandist churchmedian yearest yearestmedian

label var villagenum "Village"
label var villchurchcount "N (RIs)"
label var churchmeandist "(Mean)"
label var churchmedian "(Median)"
label var yearest "(Mean)"
label var yearestmedian "(Median)"
mkmat villchurchcount-yearestmedian, mat(villRIstats) rownames(villagenum)


matmap villRIstats villRIstats, map(round(@, 0.01))

frmttable using villRIstats.tex, tex statmat(villRIstats) replace frag sfmt(f) sdec(0, 2, 2, 1, 1) ///
ctitle("Village" "N (RIs)" "Dist HH Mean" "Dist HH Median" "Year Est Mean" "Year Est Median") ///
rtitle("Village 1"\"Village 2"\"Village 3"\"Village 4/5"\"Village 6"\"Village 7"\"Village 8"\"Village 9"\"Village 10"\"Village 11"\"Village 12"\"Village 13"\"Village 14"\"Village 15"\"Village 16"\"Village 17"\"Village 18")






